package com.itheima.test3;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.InetAddress;
import java.net.MulticastSocket;

public class Receive {
    public static void main(String[] args) throws IOException {

            MulticastSocket ms=new MulticastSocket(10001);
            byte[] pack=new byte[1024];
            DatagramPacket dp=new DatagramPacket(pack, pack.length);
            ms.joinGroup(InetAddress.getByName("224.0.1.1"));
            ms.receive(dp);
            byte [] pack1=dp.getData();
            System.out.println(new String(pack1,0,dp.getLength()));
            ms.close();

    }

}